cmake_minimum_required(VERSION 3.19)
project(Data_Structure_Notes)

set(CMAKE_CXX_STANDARD 14)

add_executable(Data_Structure 01-preface/Status.c 01-preface/Status.h 02-List/SqList.cpp 02-List/LinkList.cpp 02-List/LinkList_Du.cpp 02-List/sqlist_ex.cpp 02-List/Lists.cpp 02-List/LinkList_ex.cpp)


# 遍历项目根目录下所有的 .cpp 文件
file(GLOB files *.cpp)
foreach (file ${files})
    string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file})
    add_executable(${exe} ${file} 03-Stack_Queue_Array/SqStack.cpp Exercise/02-list/sqlist.cpp 05-tree/BiTree.cpp 06-graph/MGraph.cpp 06-graph/MGraph.h 06-graph/ALGraph.cpp 06-graph/ALGraph.h 07-Index/index.cpp 07-Index/index.h
            02-List/Lists.cpp
            02-List/Lists.cpp
            02-List/exercise-sqlist/01-ListDeleteMin.cpp
            02-List/exercise-sqlist/02-ListReverse.cpp
            02-List/exercise-sqlist/03-del_x_1.cpp
            02-List/exercise-sqlist/04-Del_s_t.cpp
            02-List/exercise-sqlist/05-Del_s_t2.cpp
            02-List/exercise-sqlist/06-Delete_duplicated.cpp
            02-List/exercise-sqlist/07-Merge.cpp
            02-List/exercise-sqlist/08-Reverse.cpp
            02-List/exercise-sqlist/09-SearchExchangeInsert.cpp
            02-List/exercise-link/01-Del_x.cpp
            02-List/exercise-link/02-Del_x2.cpp
            02-List/exercise-link/03-Reverse_Traverse.cpp
            02-List/exercise-link/04-Del_Min_Value.cpp
            02-List/exercise-link/05-ReverseLinkList.cpp
            02-List/exercise-link/06-Increase_List.cpp
            02-List/exercise-link/07-Del_s_t.cpp
            02-List/exercise-link/08-common_node.cpp
            02-List/exercise-link/09-increase_output_link.cpp
            02-List/exercise-link/10-break_link.cpp
            02-List/exercise-link/11-break-link2.cpp
            02-List/exercise-link/12-delete_duplicate.cpp
            02-List/exercise-link/13-merge-reverse_link.cpp
            02-List/exercise-link/14-Common_Node2.cpp
            02-List/exercise-link/15-Intersection.cpp
            02-List/exercise-link/16-Sub_LinkList.cpp
            02-List/exercise-link/17-Symmetry_DuLink.cpp 03-Stack_Queue_Array/stack-ex/01-judge_seriers.cpp 03-Stack_Queue_Array/queue-ex/01-queue_reverse.cpp 05-tree/exercise/01-SqTree_common_ancient.cpp)
    message(\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe})
endforeach ()


add_executable(SqList 02-List/SqList.cpp)
add_executable(LinkList 02-List/LinkList.cpp)
add_executable(SqStack 03-Stack_Queue_Array/SqStack.cpp 03-Stack_Queue_Array/LinkStack.cpp 03-Stack_Queue_Array/SqQueue.cpp 03-Stack_Queue_Array/LinkQueue.cpp)
add_executable(LinkStack 03-Stack_Queue_Array/LinkStack.cpp)
add_executable(SqQueue 03-Stack_Queue_Array/SqQueue.cpp)
add_executable(LinkQueue 03-Stack_Queue_Array/LinkQueue.cpp)

add_executable(sqlist_ex 02-List/sqlist_ex.cpp)
add_executable(BiTree 05-tree/BiTree.cpp)
add_executable(Lists 02-List/Lists.cpp
        02-List/Lists.cpp)
add_executable(14-Common_Node2 02-List/exercise-link/14-Common_Node2.cpp)
add_executable(01-judge_seriers 03-Stack_Queue_Array/stack-ex/01-judge_seriers.cpp)
add_executable(02-Symmetry_Link 03-Stack_Queue_Array/stack-ex/02-Symmetry_Link.cpp)
add_executable(01-queue_reverse 03-Stack_Queue_Array/queue-ex/01-queue_reverse.cpp)
add_executable(01-Tree_Traverse 05-tree/exercise/01-SqTree_common_ancient.cpp 05-tree/exercise/05-completed_bitree.cpp 05-tree/exercise/06-double_node_count.cpp 05-tree/exercise/07-swap_tree.cpp 05-tree/exercise/08-node_k_value.cpp 05-tree/exercise/09-del_x_BiTNode.cpp 05-tree/exercise/10-output_ancestor.cpp 05-tree/exercise/11-common_ancestor_linktree.cpp)
add_executable(02-BiTree_Traverse 05-tree/exercise/02-BiTree_Traverse.cpp)
add_executable(03-tree_depth 05-tree/exercise/03-tree_depth.cpp)

add_executable(04-create_tree_by_preorder_and_inorder 05-tree/exercise/04-create_tree_by_preorder_and_inorder.cpp)
add_executable(07-completed_bitree 05-tree/exercise/05-completed_bitree.cpp)
add_executable(06-double_node_count 05-tree/exercise/06-double_node_count.cpp)
add_executable(07-swap_tree 05-tree/exercise/07-swap_tree.cpp)
add_executable(08-node_k_value 05-tree/exercise/08-node_k_value.cpp)
add_executable(09-del_x_BiTNode 05-tree/exercise/09-del_x_BiTNode.cpp)
add_executable(10-output_ancestor 05-tree/exercise/10-output_ancestor.cpp)
